Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import
|
3 |
|
4 |
-
# Load the model
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
|
|
9 |
|
10 |
# Define the prediction function
|
11 |
def predict(text):
|
@@ -45,4 +48,3 @@ interface = gr.Interface(
|
|
45 |
# Launch the Gradio app
|
46 |
if __name__ == "__main__":
|
47 |
interface.launch()
|
48 |
-
|
|
|
1 |
+
import re
|
2 |
+
import torch
|
3 |
import gradio as gr
|
4 |
+
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
5 |
|
6 |
+
# Load the model and tokenizer from Hugging Face repository
|
7 |
+
model_repo_id = "Ajay12345678980/QA_bot" # Your model repository
|
8 |
|
9 |
+
# Initialize the model and tokenizer
|
10 |
+
model = GPT2LMHeadModel.from_pretrained(model_repo_id)
|
11 |
+
tokenizer = GPT2Tokenizer.from_pretrained(model_repo_id)
|
12 |
|
13 |
# Define the prediction function
|
14 |
def predict(text):
|
|
|
48 |
# Launch the Gradio app
|
49 |
if __name__ == "__main__":
|
50 |
interface.launch()
|
|