Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
from transformers import AutoTokenizer
|
4 |
-
from generate import load_model, generate_text
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
TOKENIZER_NAME = "gpt2" # Or your custom tokenizer
|
10 |
-
MAX_TOKENS = 50
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
output = generate_text(model, tokenizer, prompt, max_new_tokens=MAX_TOKENS, device=DEVICE)
|
19 |
-
return output
|
20 |
|
21 |
-
|
22 |
-
iface = gr.Interface(fn=chat,
|
23 |
-
inputs=gr.Textbox(label="Ask Evo..."),
|
24 |
-
outputs=gr.Textbox(label="Evo's Response"),
|
25 |
-
title="🧠 EvoDecoder Chatbot",
|
26 |
-
description="A lightweight conversational model powered by EvoDecoder")
|
27 |
-
|
28 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from generate.py import generate_response
|
|
|
|
|
3 |
|
4 |
+
def chat_with_evo(user_input):
|
5 |
+
response = generate_response(user_input)
|
6 |
+
return response
|
|
|
|
|
7 |
|
8 |
+
with gr.Blocks() as demo:
|
9 |
+
gr.Markdown("## 🤖 EvoDecoder Chatbot (Lightweight Conversational AI)")
|
10 |
+
with gr.Row():
|
11 |
+
with gr.Column(scale=4):
|
12 |
+
user_input = gr.Textbox(label="Ask Evo anything...", placeholder="Type your question here...")
|
13 |
+
submit_btn = gr.Button("Submit")
|
14 |
+
with gr.Column(scale=6):
|
15 |
+
response_output = gr.Textbox(label="Evo's Response")
|
16 |
|
17 |
+
submit_btn.click(fn=chat_with_evo, inputs=user_input, outputs=response_output)
|
|
|
|
|
18 |
|
19 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|