Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from huggingface_hub import InferenceClient
|
3 |
+
|
4 |
+
client = InferenceClient(model="https://p06bw0bote3egf-80.proxy.runpod.net/")
|
5 |
+
|
6 |
+
def inference(message, history):
|
7 |
+
partial_message = ""
|
8 |
+
for token in client.text_generation(message, max_new_tokens=128, stream=True):
|
9 |
+
partial_message += token
|
10 |
+
yield partial_message
|
11 |
+
|
12 |
+
gr.ChatInterface(
|
13 |
+
inference,
|
14 |
+
chatbot=gr.Chatbot(height=300),
|
15 |
+
textbox=gr.Textbox(placeholder="Please ask your question here...", container=False, scale=7),
|
16 |
+
description="This is a chatbot trained on the Llama2-13b model.",
|
17 |
+
title="SequoiaDB AI",
|
18 |
+
examples=["What is SequioaDB?", "What is SequioaDB's license?", "What is SequioaDB's official website?"],
|
19 |
+
retry_btn="Retry",
|
20 |
+
undo_btn="Undo",
|
21 |
+
clear_btn="Clear",
|
22 |
+
submit_btn="Submit",
|
23 |
+
).queue().launch()
|