Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -91,68 +91,67 @@ if __name__ == "__main__":
|
|
| 91 |
demo = gr.Blocks()
|
| 92 |
with demo:
|
| 93 |
with gr.Row():
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
with gr.
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
)
|
| 156 |
gr.Markdown(
|
| 157 |
"""### GitHub Repo: [MTech Thesis Project](https://github.com/Amir22010)
|
| 158 |
### Author: [Amir Khan](https://github.com/Amir22010)
|
|
|
|
| 91 |
demo = gr.Blocks()
|
| 92 |
with demo:
|
| 93 |
with gr.Row():
|
| 94 |
+
with gr.Column():
|
| 95 |
+
gr.Markdown(
|
| 96 |
+
"# <p align='center'>Hospital Review Aspect Sentiment Generation</p>"
|
| 97 |
+
)
|
| 98 |
+
with gr.Row():
|
| 99 |
+
with gr.Column():
|
| 100 |
+
asde_input_sentence = gr.Textbox(
|
| 101 |
+
placeholder="Leave this box blank and choose a dataset will give you a random example...",
|
| 102 |
+
label="Example:",
|
| 103 |
+
)
|
| 104 |
+
gr.Markdown(
|
| 105 |
+
"You can find code and dataset at [MTech Thesis Project](https://github.com/Amir22010)"
|
| 106 |
+
)
|
| 107 |
+
asde_dataset_ids = gr.Radio(
|
| 108 |
+
choices=[
|
| 109 |
+
"HospitalReviews"
|
| 110 |
+
],
|
| 111 |
+
value="HospitalReviews",
|
| 112 |
+
label="Datasets",
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
asde_model_ids = gr.Radio(
|
| 116 |
+
choices=[
|
| 117 |
+
"PyABSA_Hospital_English_allenai/tk-instruct-base-def-pos_FinedTuned_Model",
|
| 118 |
+
# "PyABSA_Hospital_Multilingual_allenai/tk-instruct-base-def-pos_FinedTuned_Model",
|
| 119 |
+
# "PyABSA_Hospital_KeyBert_allenai/tk-instruct-base-def-pos_FinedTuned_Model"
|
| 120 |
+
],
|
| 121 |
+
value="PyABSA_Hospital_English_allenai/tk-instruct-base-def-pos_FinedTuned_Model",
|
| 122 |
+
label="Fine-tuned Models on Hospital Review custom data",
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
asde_inference_button = gr.Button("Let's go!")
|
| 126 |
+
|
| 127 |
+
asde_output_text = gr.TextArea(label="Example:")
|
| 128 |
+
|
| 129 |
+
asde_model_output_generated_sentence = gr.Textbox(
|
| 130 |
+
placeholder="Text Generated...",
|
| 131 |
+
label="Model Prediction Text Generated:",
|
| 132 |
+
)
|
| 133 |
+
asde_output_pred_df = gr.DataFrame(
|
| 134 |
+
label="Predicted Aspect & Sentiment:"
|
| 135 |
+
)
|
| 136 |
+
asde_output_true_df = gr.DataFrame(
|
| 137 |
+
label="Original Aspect & Sentiment:"
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
asde_inference_button.click(
|
| 141 |
+
fn=run_demo,
|
| 142 |
+
inputs=[
|
| 143 |
+
asde_input_sentence,
|
| 144 |
+
asde_dataset_ids,
|
| 145 |
+
asde_model_ids,
|
| 146 |
+
gr.Text("ASDE", visible=False),
|
| 147 |
+
],
|
| 148 |
+
outputs=[
|
| 149 |
+
asde_output_pred_df,
|
| 150 |
+
asde_output_true_df,
|
| 151 |
+
asde_output_text,
|
| 152 |
+
asde_model_output_generated_sentence
|
| 153 |
+
],
|
| 154 |
+
)
|
|
|
|
| 155 |
gr.Markdown(
|
| 156 |
"""### GitHub Repo: [MTech Thesis Project](https://github.com/Amir22010)
|
| 157 |
### Author: [Amir Khan](https://github.com/Amir22010)
|