Spaces:
Runtime error
Runtime error
Schweigert
commited on
Commit
•
0837817
1
Parent(s):
fc47d43
starting appl. with llm
Browse files- app.py +22 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipe = pipeline("text2text-generation", model="lmsys/fastchat-t5-3b-v1.0")
|
5 |
+
|
6 |
+
def predict(text, history):
|
7 |
+
|
8 |
+
return pipe(text)[0]["generated_text"]
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
gr.ChatInterface(
|
13 |
+
fn = predict,
|
14 |
+
chatbot=gr.Chatbot(height=800),
|
15 |
+
textbox=gr.Textbox(placeholder="<Your question>", container=False, scale=7),
|
16 |
+
title="Enter your question",
|
17 |
+
description="Ask a question to the following model: lmsys/fastchat-t5-3b-v1.0",
|
18 |
+
theme="soft",
|
19 |
+
retry_btn=None,
|
20 |
+
undo_btn="Delete Previous",
|
21 |
+
clear_btn="Clear"
|
22 |
+
).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers @ git+https://github.com/huggingface/transformers.git@b413e0610b42d4c8d9c7a69c06440ad27c69808b
|
2 |
+
torch
|