Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# تعديل إعدادات pipeline | |
pipe = pipeline( | |
"text-generation", | |
model="deepseek-ai/deepseek-coder-1.3b-base", | |
device_map="cpu", # نحدد CPU بشكل صريح | |
low_cpu_mem_usage=False # نعطل هذا الخيار | |
) | |
def generate_response(prompt): | |
result = pipe(prompt, max_length=100) | |
return result[0]['generated_text'] | |
iface = gr.Interface( | |
fn=generate_response, | |
inputs="text", | |
outputs="text" | |
) | |
iface.launch() |