Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import openai
|
| 3 |
-
|
| 4 |
-
# Replace "YOUR_OPENAI_API_KEY" with your actual OpenAI API key
|
| 5 |
-
openai_api_key = "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"
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
def chatbot(question):
|
| 9 |
-
message_log = [
|
| 10 |
-
{"role": "user", "content": question}
|
| 11 |
-
]
|
| 12 |
-
|
| 13 |
-
response = openai.ChatCompletion.create(
|
| 14 |
-
model="gpt-3.5-turbo-16k",
|
| 15 |
-
messages=message_log,
|
| 16 |
-
max_tokens=8800,
|
| 17 |
-
request_timeout=35,
|
| 18 |
-
stop=None,
|
| 19 |
-
temperature=0.9
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
return response.choices[0].message.content
|
| 23 |
-
|
| 24 |
-
# Create the Gradio interface
|
| 25 |
-
iface = gr.Interface(
|
| 26 |
-
fn=chatbot,
|
| 27 |
-
inputs=gr.components.Textbox(lines=7, placeholder="Enter your question here"),
|
| 28 |
-
outputs="text",
|
| 29 |
-
title="Frost AI ChatBot: Your Knowledge Companion Powered-by ChatGPT",
|
| 30 |
-
description="Ask any question about rahasak research papers"
|
| 31 |
-
)
|
| 32 |
-
|
| 33 |
-
# Launch the Gradio interface
|
| 34 |
-
iface.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|