Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Delete app.py
Browse files
    	
        app.py
    DELETED
    
    | @@ -1,24 +0,0 @@ | |
| 1 | 
            -
            from transformers import AutoModelForCausalLM, AutoTokenizer
         | 
| 2 | 
            -
            import gradio as gr
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            # تحميل النموذج والTokenizer
         | 
| 5 | 
            -
            model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-mini-instruct")
         | 
| 6 | 
            -
            tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-4-mini-instruct")
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            # وظيفة للتفاعل مع النموذج
         | 
| 9 | 
            -
            def generate_response(user_input):
         | 
| 10 | 
            -
                inputs = tokenizer(user_input, return_tensors="pt")
         | 
| 11 | 
            -
                outputs = model.generate(**inputs, max_new_tokens=500)
         | 
| 12 | 
            -
                return tokenizer.decode(outputs[0], skip_special_tokens=True)
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            # واجهة Gradio
         | 
| 15 | 
            -
            interface = gr.Interface(
         | 
| 16 | 
            -
                fn=generate_response,
         | 
| 17 | 
            -
                inputs="text",
         | 
| 18 | 
            -
                outputs="text",
         | 
| 19 | 
            -
                title="Phi-4-mini-instruct Chatbot",
         | 
| 20 | 
            -
                description="تفاعل مع نموذج Phi-4-mini-instruct من Microsoft."
         | 
| 21 | 
            -
            )
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            # تشغيل الواجهة
         | 
| 24 | 
            -
            interface.launch()
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
