Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
3 |
+
|
4 |
+
model_id = "bartowski/cognitivecomputations_Dolphin-Mistral-24B-Venice-Edition-GGUF"
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)
|
6 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
7 |
+
chat = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=200)
|
8 |
+
|
9 |
+
def respond(prompt):
|
10 |
+
return chat(prompt)[0]["generated_text"]
|
11 |
+
|
12 |
+
gr.Interface(
|
13 |
+
fn=respond,
|
14 |
+
inputs=gr.Textbox(lines=2, placeholder="say something…"),
|
15 |
+
outputs="text",
|
16 |
+
title="dolphin mistral 24b venice chat",
|
17 |
+
).launch()
|