Update app.py
Browse files
app.py
CHANGED
|
@@ -26,26 +26,10 @@ def generate_response(prompt, max_length=50, temperature=0.8):
|
|
| 26 |
|
| 27 |
return response
|
| 28 |
|
| 29 |
-
def chat_room_ui():
|
| 30 |
-
user_input = gr.Textbox(prompt="User Input", placeholder="Type your message...")
|
| 31 |
-
chat_display = gr.Textbox(text=chat_history, label="Chat Room", readonly=True)
|
| 32 |
-
generate_button = gr.Button(text="Generate Response")
|
| 33 |
-
|
| 34 |
-
def generate_response_callback():
|
| 35 |
-
global chat_history
|
| 36 |
-
user_prompt = user_input.value
|
| 37 |
-
response = generate_response(user_prompt)
|
| 38 |
-
chat_history += f" User: {user_prompt} Assistant: {response}"
|
| 39 |
-
chat_display.value = chat_history
|
| 40 |
-
|
| 41 |
-
generate_button.click(generate_response_callback)
|
| 42 |
-
|
| 43 |
-
return gr.Column([user_input, chat_display, generate_button])
|
| 44 |
-
|
| 45 |
iface = gr.Interface(
|
| 46 |
-
fn=
|
| 47 |
-
|
| 48 |
-
|
| 49 |
)
|
| 50 |
|
| 51 |
-
iface.launch()
|
|
|
|
| 26 |
|
| 27 |
return response
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
iface = gr.Interface(
|
| 30 |
+
fn=generate_response,
|
| 31 |
+
inputs=gr.Textbox(),
|
| 32 |
+
outputs="text",
|
| 33 |
)
|
| 34 |
|
| 35 |
+
iface.launch()
|