Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from chat import generate_response
|
| 4 |
+
|
| 5 |
+
def gradio_interface(user_input, max_tokens, temperature):
|
| 6 |
+
return generate_response(user_input, max_length=max_tokens, temperature=temperature)
|
| 7 |
+
|
| 8 |
+
iface = gr.Interface(
|
| 9 |
+
fn=gradio_interface,
|
| 10 |
+
inputs=[
|
| 11 |
+
gr.Textbox(lines=3, placeholder="Type your message here...", label="User Input"),
|
| 12 |
+
gr.Slider(minimum=50, maximum=2000, step=50, label="Max Tokens", value=200),
|
| 13 |
+
gr.Slider(minimum=0.1, maximum=1.0, step=0.1, label="Temperature", value=0.7)
|
| 14 |
+
],
|
| 15 |
+
outputs="text",
|
| 16 |
+
title="ChatGpt Tune",
|
| 17 |
+
description="Chat with your Hugging Face model using safetensors for fast loading!"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
iface.launch(share=True)
|