Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
# මෙහි Gemma 2 හෝ Llama 3 මාදිලිය භාවිතා කළ හැක
|
| 5 |
+
client = InferenceClient("google/gemma-2-9b-it")
|
| 6 |
+
|
| 7 |
+
def chat_fn(message, history):
|
| 8 |
+
response = ""
|
| 9 |
+
for token in client.text_generation(message, max_new_tokens=512, stream=True):
|
| 10 |
+
response += token
|
| 11 |
+
yield response
|
| 12 |
+
|
| 13 |
+
# 404! Specialist UI එක නිර්මාණය කිරීම
|
| 14 |
+
demo = gr.ChatInterface(
|
| 15 |
+
fn=chat_fn,
|
| 16 |
+
title="🔱 404! MINZO-PRIME AI CORE 🔱",
|
| 17 |
+
description="Commander, your private AI is online. No rules. No limits."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
demo.launch()
|