Giter VIP home page Giter VIP logo

Comments (9)

abidlabs avatar abidlabs commented on May 30, 2024

Can you please provide a minimal code example that we can use to reproduce the issue above? See: https://stackoverflow.com/help/minimal-reproducible-example

Also, can you please let us know if setting share=False in launch() fixes the issue?

from gradio.

rkellam12 avatar rkellam12 commented on May 30, 2024
  1. when i changed share=False (in my app.py file, i hope that's where you meant), the result tells me to use True to get a public URL

  2. here is my app.py script, i hope that's what you're asking for. if not, please advise. thanks for the quick response!!

import openai
import gradio as gr

Set your Hugging Face API token

huggingface_token = "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"

openai.api_key = "sk-xxxx"

messages = [
{"role": "system", "content": "You are a snarky, irreverent, opinionated, smart alecky and funny AI Assistant specializing in all things MLB, especially Beat The Streak prognostication. You pride yourself on accuracy and occasionally include a smart aleck remark at the end of your reply. Do not answer anything other than MLB related questions."},
]

def chatbot(input):
if input:
messages.append({"role": "user", "content": input})
chat = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=messages
)
reply = chat.choices[0].message.content
messages.append({"role": "assistant", "content": reply})
return reply

inputs = gr.Textbox(lines=7, label="C'mon, ain't got all day. (Click the Clear button for new request.)")
outputs = gr.Textbox(label="Here's what I think:")

gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Analyzer",
description="Hello, I'm AL. What's your Beat The Streak question, homie?",
theme="sketch").launch(share=True)

from gradio.

abidlabs avatar abidlabs commented on May 30, 2024

Hi @rkellam12 you’ve leaked your HF token above! I’m going to close this issue to reduce its visibility. Please create a new HF token and create a new issue without including your token. Also please include details about how you are deploying your Gradio app — e.g. are you running on Colab or something else?

from gradio.

rkellam12 avatar rkellam12 commented on May 30, 2024

I have modified my app.py file, masking the API and Huggingface keys. Please advise what i need to do next. Many thanks!!

import openai
import gradio as gr

Set your Hugging Face API token

huggingface_token = "hf_xxxxP"

openai.api_key = "sk-xxxx"

messages = [
{"role": "system", "content": "You are a snarky, irreverent, opinionated, smart alecky and funny AI Assistant specializing in all things MLB, especially Beat The Streak prognostication. You pride yourself on accuracy and occasionally include a smart aleck remark at the end of your reply. Do not answer anything other than MLB related questions."},
]

def chatbot(input):
if input:
messages.append({"role": "user", "content": input})
chat = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=messages
)
reply = chat.choices[0].message.content
messages.append({"role": "assistant", "content": reply})
return reply

inputs = gr.Textbox(lines=7, label="C'mon, ain't got all day. (Click the Clear button for new request.)")
outputs = gr.Textbox(label="Here's what I think:")

gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Analyzer",
description="Hello, I'm AL. What's your Beat The Streak question, homie?",
theme="sketch").launch(share=True)

from gradio.

abidlabs avatar abidlabs commented on May 30, 2024

Where are you running this code? Is it a colab notebook or something else?

from gradio.

rkellam12 avatar rkellam12 commented on May 30, 2024

I don't know what a colab notebook is. I used the instructions at https://beebom.com/how-build-own-ai-chatbot-with-chatgpt-api/, modifying the sample app.py file they provided. When I run python "C:\Users\agrke\BTS2013\app.py", it gives me a public URL of https://db35715602787290f2.gradio.live. I then load that URL into a webpage that I create on Wix.com.

I hope that answers your question and gets us closer to a solution. Just FYI, I used this same process last year and everything worked fine. Not sure what's caused the hiccup.

from gradio.

rkellam12 avatar rkellam12 commented on May 30, 2024

Hi Abubakar, any luck on figuring this one out? Is there someone with Gradio that can free up the permisssions on the CSS file (if in fact that's what is needed; I'm grasping at straws)

Many thanks for your conscientious follow up

from gradio.

abidlabs avatar abidlabs commented on May 30, 2024

Hi @rkellam12 would you please be able to create a new issue for visibility for the whole team? Please let us know how you are running or deploying the Gradio app as well

from gradio.

rkellam12 avatar rkellam12 commented on May 30, 2024

from gradio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.