File size: 566 Bytes
004744a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()