Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
chat = pipeline("text-generation", model="LeoLM/leo-mistral-hessianai-7b-chat")
|
|
|
5 |
|
6 |
+
|
7 |
+
def chat_with_model(prompt):
|
8 |
+
response = chat(prompt, max_length=50)
|
9 |
+
return response[0]['generated_text']
|
10 |
+
|
11 |
+
# Create the Gradio interface
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=chat_with_model,
|
14 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Type your message here..."),
|
15 |
+
outputs="text",
|
16 |
+
title="Chat with LLM",
|
17 |
+
description="Type a message and chat with a language model."
|
18 |
+
)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
iface.launch()
|