Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load an open-source model (example: Llama 3)
|
| 5 |
+
chatbot = pipeline("text-generation", model="meta-llama/Llama-3")
|
| 6 |
+
|
| 7 |
+
def chat_fn(message):
|
| 8 |
+
response = chatbot(message, max_length=200, do_sample=True)
|
| 9 |
+
return response[0]["generated_text"]
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(
|
| 12 |
+
fn=chat_fn,
|
| 13 |
+
inputs="text",
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="M Tech Calibration Lab LLP Chatbot",
|
| 16 |
+
description="Ask me about instruments and guides!"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
iface.launch()
|