Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Initialize a dictionary with some models for selection
|
| 5 |
-
models = {
|
| 6 |
-
"Google mt5-base": "google/mt5-base",
|
| 7 |
-
"GPT-2": "gpt2",
|
| 8 |
-
"BERT": "bert-base-uncased"
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
# Function to generate text based on the model
|
| 12 |
def chatbot(user_input, history, max_length=50, temperature=1.0):
|
| 13 |
# Load the selected model (using a hard-coded model for now)
|
|
@@ -29,9 +22,6 @@ def create_chat_interface():
|
|
| 29 |
|
| 30 |
# Define the chat interface
|
| 31 |
with gr.Row():
|
| 32 |
-
# Settings button (Small square icon)
|
| 33 |
-
settings_button = gr.Button("⚙️", elem_id="settings_button", scale=1)
|
| 34 |
-
|
| 35 |
# Chatbot component
|
| 36 |
chatbot_component = gr.Chatbot(type="messages", label="Chat History", height=500)
|
| 37 |
|
|
@@ -56,9 +46,6 @@ def create_chat_interface():
|
|
| 56 |
outputs=chatbot_component,
|
| 57 |
)
|
| 58 |
|
| 59 |
-
# Toggle the settings menu when the settings button is clicked
|
| 60 |
-
settings_button.click(lambda: settings.toggle(), None, None)
|
| 61 |
-
|
| 62 |
demo.launch()
|
| 63 |
|
| 64 |
# Launch the interface
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Function to generate text based on the model
|
| 5 |
def chatbot(user_input, history, max_length=50, temperature=1.0):
|
| 6 |
# Load the selected model (using a hard-coded model for now)
|
|
|
|
| 22 |
|
| 23 |
# Define the chat interface
|
| 24 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
| 25 |
# Chatbot component
|
| 26 |
chatbot_component = gr.Chatbot(type="messages", label="Chat History", height=500)
|
| 27 |
|
|
|
|
| 46 |
outputs=chatbot_component,
|
| 47 |
)
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
demo.launch()
|
| 50 |
|
| 51 |
# Launch the interface
|