Spaces:
Sleeping
Sleeping
File size: 517 Bytes
0ecc230 a53a69e 0ecc230 0e4a5b6 a53a69e 0e4a5b6 0ecc230 a53a69e 0ecc230 a53a69e 0ecc230 a53a69e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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() |