Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,10 @@ def load_model(model_name):
|
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b")
|
| 27 |
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b")
|
| 28 |
return model, tokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
else:
|
| 30 |
st.error(f"Model {model_name} not available.")
|
| 31 |
return None, None
|
|
@@ -41,7 +45,7 @@ def main():
|
|
| 41 |
st.title("Question Generation From Given Text")
|
| 42 |
context = st.text_area("Enter text","Laughter is the best medicine.")
|
| 43 |
st.write("Select a model and provide the text to generate questions.")
|
| 44 |
-
model_choice = st.selectbox("Select a model", ["T5", "Llama3", "Llama3-Instruct","Phi3","Gemma"])
|
| 45 |
|
| 46 |
if st.button("Generate Questions"):
|
| 47 |
model, tokenizer = load_model(model_choice)
|
|
|
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b")
|
| 27 |
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b")
|
| 28 |
return model, tokenizer
|
| 29 |
+
if model_name == "Qwen":
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-72B-Instruct")
|
| 31 |
+
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-72B-Instruct")
|
| 32 |
+
return model, tokenizer
|
| 33 |
else:
|
| 34 |
st.error(f"Model {model_name} not available.")
|
| 35 |
return None, None
|
|
|
|
| 45 |
st.title("Question Generation From Given Text")
|
| 46 |
context = st.text_area("Enter text","Laughter is the best medicine.")
|
| 47 |
st.write("Select a model and provide the text to generate questions.")
|
| 48 |
+
model_choice = st.selectbox("Select a model", ["T5", "Llama3", "Llama3-Instruct","Phi3","Gemma","Qwen"])
|
| 49 |
|
| 50 |
if st.button("Generate Questions"):
|
| 51 |
model, tokenizer = load_model(model_choice)
|