Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from llama_cpp import Llama
|
3 |
|
4 |
+
model_path = "vislupus/bulgarian-joke-master-SmolLM2-135M-Instruct-bnb-4bit-gguf"
|
5 |
+
llm = Llama(model_path=model_path)
|
6 |
+
|
7 |
+
def generate_response(prompt):
|
8 |
+
"""Generate a response using the GGUF model."""
|
9 |
+
output = llm(prompt, max_tokens=200)
|
10 |
+
return output['choices'][0]['text']
|
11 |
+
|
12 |
+
with gr.Blocks() as demo:
|
13 |
+
gr.Markdown("# GGUF Model Chatbot")
|
14 |
+
with gr.Row():
|
15 |
+
with gr.Column():
|
16 |
+
prompt_input = gr.Textbox(label="Your Prompt", placeholder="Type something...")
|
17 |
+
submit_button = gr.Button("Generate")
|
18 |
+
with gr.Column():
|
19 |
+
output_box = gr.Textbox(label="Model Response")
|
20 |
+
|
21 |
+
submit_button.click(fn=generate_response, inputs=prompt_input, outputs=output_box)
|
22 |
|
|
|
23 |
demo.launch()
|