Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
pipe = pipeline("text-generation", model="Qwen/Qwen2.5-0.5B-Instruct")
|
| 6 |
|
| 7 |
def generate_response(prompt):
|
| 8 |
-
# Prompt'u modele gönderip yanıtı alıyoruz
|
| 9 |
output = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7)
|
| 10 |
return output[0]['generated_text']
|
| 11 |
|
| 12 |
-
# Arayüzü oluşturuyoruz (Arka planda otomatik API endpoint açar)
|
| 13 |
demo = gr.Interface(fn=generate_response, inputs="text", outputs="text")
|
| 14 |
-
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# device="cpu" ekliyoruz ki sistem boşuna GPU arayıp çökmesin
|
| 5 |
+
pipe = pipeline("text-generation", model="Qwen/Qwen2.5-0.5B-Instruct", device="cpu")
|
| 6 |
|
| 7 |
def generate_response(prompt):
|
|
|
|
| 8 |
output = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7)
|
| 9 |
return output[0]['generated_text']
|
| 10 |
|
|
|
|
| 11 |
demo = gr.Interface(fn=generate_response, inputs="text", outputs="text")
|
| 12 |
+
|
| 13 |
+
# Sunucu ayarlarını manuel belirterek başlatıyoruz
|
| 14 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|