Sakshi1307 commited on
Commit
c32d7b9
1 Parent(s): 30c6475

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoModelForCausalLM, AutoTokenizer
3
+
4
+ # Load your model and tokenizer
5
+ model_name = "Sakshi1307/SakshiAI"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
7
+ model = AutoModelForCausalLM.from_pretrained(model_name)
8
+
9
+ def generate_answer(question):
10
+ inputs = tokenizer.encode(question, return_tensors='pt')
11
+ outputs = model.generate(inputs, max_length=500, num_return_sequences=1)
12
+ answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
13
+ return answer
14
+
15
+ # Create a Gradio interface
16
+ iface = gr.Interface(
17
+ fn=generate_answer,
18
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your interview question here..."),
19
+ outputs="text",
20
+ title="Interview Simulation AI",
21
+ description="This AI model simulates me in an interview questions. Type in a question and see how it responds!"
22
+ )
23
+
24
+ # Launch the application
25
+ if __name__ == "__main__":
26
+ iface.launch()