Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the AI model | |
| model = pipeline("text-generation", model="STEM-AI-mtl/phi-2-electrical-engineering") | |
| # Function to process user questions | |
| def get_ai_answer(question): | |
| response = model(question, max_length=200, do_sample=True) | |
| return response[0]["generated_text"] | |
| # Gradio UI | |
| iface = gr.Interface( | |
| fn=get_ai_answer, | |
| inputs="text", | |
| outputs="text", | |
| title="Circuit Debugging AI", | |
| description="Ask electrical engineering or circuit debugging questions!" | |
| ) | |
| # Launch | |
| iface.launch() | |