Spaces:
Sleeping
Sleeping
Delete gradio.py
Browse files
gradio.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from langchain import OpenAI, ConversationChain
|
3 |
-
|
4 |
-
# Initialize the OpenAI LLM
|
5 |
-
|
6 |
-
llm = OpenAI(temperature=0.7)
|
7 |
-
|
8 |
-
# Initialize the conversation chain
|
9 |
-
|
10 |
-
conversation = ConversationChain(llm=llm)
|
11 |
-
|
12 |
-
# Function to respond to user input
|
13 |
-
|
14 |
-
def respond_to_input(user_input):
|
15 |
-
|
16 |
-
return conversation.run(user_input)
|
17 |
-
|
18 |
-
|
19 |
-
# Gradio Interface
|
20 |
-
|
21 |
-
def chat_interface(user_input):
|
22 |
-
response = respond_to_input(user_input)
|
23 |
-
return response
|
24 |
-
# Create Gradio interface
|
25 |
-
|
26 |
-
iface = gr.Interface(fn=chat_interface, inputs="text", outputs="text", title="LangChain Chatbot")
|
27 |
-
# Launch Gradio Interface
|
28 |
-
iface.launch()
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|