Spaces:
Running
Running
Commit
·
faaacd7
1
Parent(s):
c925dd5
feat:2.0
Browse files
app.py
CHANGED
@@ -71,10 +71,6 @@ def load_model(hf_token):
|
|
71 |
"google/gemma-2b", # Try base 2B model next
|
72 |
"google/gemma-7b-it", # Try 7B instruction-tuned model
|
73 |
"google/gemma-7b", # Try base 7B model
|
74 |
-
# Fallback to completely different models if all Gemma models fail
|
75 |
-
"meta-llama/Llama-2-7b-chat-hf",
|
76 |
-
"facebook/opt-1.3b",
|
77 |
-
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
78 |
]
|
79 |
|
80 |
print(f"Attempting to load models with token starting with: {hf_token[:5]}...")
|
@@ -467,7 +463,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
467 |
"""
|
468 |
)
|
469 |
|
470 |
-
with gr.
|
471 |
with gr.Row(equal_height=True):
|
472 |
with gr.Column(scale=1):
|
473 |
text_gen_type = gr.Radio(
|
@@ -597,7 +593,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
597 |
"""
|
598 |
)
|
599 |
|
600 |
-
with gr.
|
601 |
with gr.Row(equal_height=True):
|
602 |
with gr.Column(scale=1):
|
603 |
brainstorm_category = gr.Dropdown(
|
@@ -660,7 +656,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
660 |
"""
|
661 |
)
|
662 |
|
663 |
-
with gr.
|
664 |
with gr.Row(equal_height=True):
|
665 |
with gr.Column(scale=1):
|
666 |
content_type = gr.Dropdown(
|
@@ -730,7 +726,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
730 |
"""
|
731 |
)
|
732 |
|
733 |
-
with gr.
|
734 |
with gr.Row(equal_height=True):
|
735 |
with gr.Column(scale=1):
|
736 |
email_type = gr.Dropdown(
|
@@ -794,7 +790,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
794 |
"""
|
795 |
)
|
796 |
|
797 |
-
with gr.
|
798 |
with gr.Row(equal_height=True):
|
799 |
with gr.Column(scale=1):
|
800 |
edit_text = gr.Textbox(
|
@@ -845,7 +841,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
845 |
"""
|
846 |
)
|
847 |
|
848 |
-
with gr.
|
849 |
with gr.Row(equal_height=True):
|
850 |
with gr.Column(scale=1):
|
851 |
explain_topic = gr.Textbox(
|
@@ -908,7 +904,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
908 |
"""
|
909 |
)
|
910 |
|
911 |
-
with gr.
|
912 |
with gr.Row(equal_height=True):
|
913 |
with gr.Column(scale=1):
|
914 |
classify_text = gr.Textbox(
|
@@ -972,7 +968,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
972 |
"""
|
973 |
)
|
974 |
|
975 |
-
with gr.
|
976 |
with gr.Row(equal_height=True):
|
977 |
with gr.Column(scale=1):
|
978 |
extract_text = gr.Textbox(
|
@@ -1038,7 +1034,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1038 |
with gr.Tabs() as comprehension_tabs:
|
1039 |
# Summarization
|
1040 |
with gr.TabItem("Summarization", id="subtab_summarize"):
|
1041 |
-
with gr.
|
1042 |
with gr.Row(equal_height=True):
|
1043 |
with gr.Column(scale=1):
|
1044 |
summarize_text = gr.Textbox(
|
@@ -1062,7 +1058,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1062 |
|
1063 |
# Question Answering
|
1064 |
with gr.TabItem("Question Answering", id="subtab_qa"):
|
1065 |
-
with gr.
|
1066 |
with gr.Row(equal_height=True):
|
1067 |
with gr.Column(scale=1):
|
1068 |
qa_text = gr.Textbox(
|
@@ -1091,7 +1087,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1091 |
|
1092 |
# Translation
|
1093 |
with gr.TabItem("Translation", id="subtab_translate"):
|
1094 |
-
with gr.
|
1095 |
with gr.Row(equal_height=True):
|
1096 |
with gr.Column(scale=1):
|
1097 |
translate_text = gr.Textbox(
|
@@ -1132,7 +1128,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1132 |
with gr.Tabs() as code_tabs:
|
1133 |
# Code Generation
|
1134 |
with gr.TabItem("Code Generation", id="subtab_code_gen"):
|
1135 |
-
with gr.
|
1136 |
with gr.Row(equal_height=True):
|
1137 |
with gr.Column(scale=1):
|
1138 |
code_language = gr.Dropdown(
|
@@ -1190,7 +1186,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1190 |
|
1191 |
# Code Explanation
|
1192 |
with gr.TabItem("Code Explanation", id="subtab_code_explain"):
|
1193 |
-
with gr.
|
1194 |
with gr.Row(equal_height=True):
|
1195 |
with gr.Column(scale=1):
|
1196 |
code_to_explain = gr.Code(
|
@@ -1225,7 +1221,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1225 |
|
1226 |
# Code Debugging
|
1227 |
with gr.TabItem("Code Debugging", id="subtab_code_debug"):
|
1228 |
-
with gr.
|
1229 |
with gr.Row(equal_height=True):
|
1230 |
with gr.Column(scale=1):
|
1231 |
code_to_debug = gr.Code(
|
@@ -1259,7 +1255,7 @@ with gr.Blocks(theme=GemmaLightTheme()) as demo:
|
|
1259 |
)
|
1260 |
|
1261 |
# Footer
|
1262 |
-
with gr.
|
1263 |
gr.Markdown(
|
1264 |
"""
|
1265 |
## About Gemma
|
|
|
71 |
"google/gemma-2b", # Try base 2B model next
|
72 |
"google/gemma-7b-it", # Try 7B instruction-tuned model
|
73 |
"google/gemma-7b", # Try base 7B model
|
|
|
|
|
|
|
|
|
74 |
]
|
75 |
|
76 |
print(f"Attempting to load models with token starting with: {hf_token[:5]}...")
|
|
|
463 |
"""
|
464 |
)
|
465 |
|
466 |
+
with gr.Group(elem_id="text_gen_box"):
|
467 |
with gr.Row(equal_height=True):
|
468 |
with gr.Column(scale=1):
|
469 |
text_gen_type = gr.Radio(
|
|
|
593 |
"""
|
594 |
)
|
595 |
|
596 |
+
with gr.Group(elem_id="brainstorm_box"):
|
597 |
with gr.Row(equal_height=True):
|
598 |
with gr.Column(scale=1):
|
599 |
brainstorm_category = gr.Dropdown(
|
|
|
656 |
"""
|
657 |
)
|
658 |
|
659 |
+
with gr.Group(elem_id="content_box"):
|
660 |
with gr.Row(equal_height=True):
|
661 |
with gr.Column(scale=1):
|
662 |
content_type = gr.Dropdown(
|
|
|
726 |
"""
|
727 |
)
|
728 |
|
729 |
+
with gr.Group(elem_id="email_box"):
|
730 |
with gr.Row(equal_height=True):
|
731 |
with gr.Column(scale=1):
|
732 |
email_type = gr.Dropdown(
|
|
|
790 |
"""
|
791 |
)
|
792 |
|
793 |
+
with gr.Group(elem_id="edit_box"):
|
794 |
with gr.Row(equal_height=True):
|
795 |
with gr.Column(scale=1):
|
796 |
edit_text = gr.Textbox(
|
|
|
841 |
"""
|
842 |
)
|
843 |
|
844 |
+
with gr.Group(elem_id="explain_box"):
|
845 |
with gr.Row(equal_height=True):
|
846 |
with gr.Column(scale=1):
|
847 |
explain_topic = gr.Textbox(
|
|
|
904 |
"""
|
905 |
)
|
906 |
|
907 |
+
with gr.Group(elem_id="classify_box"):
|
908 |
with gr.Row(equal_height=True):
|
909 |
with gr.Column(scale=1):
|
910 |
classify_text = gr.Textbox(
|
|
|
968 |
"""
|
969 |
)
|
970 |
|
971 |
+
with gr.Group(elem_id="extract_box"):
|
972 |
with gr.Row(equal_height=True):
|
973 |
with gr.Column(scale=1):
|
974 |
extract_text = gr.Textbox(
|
|
|
1034 |
with gr.Tabs() as comprehension_tabs:
|
1035 |
# Summarization
|
1036 |
with gr.TabItem("Summarization", id="subtab_summarize"):
|
1037 |
+
with gr.Group(elem_id="summarize_box"):
|
1038 |
with gr.Row(equal_height=True):
|
1039 |
with gr.Column(scale=1):
|
1040 |
summarize_text = gr.Textbox(
|
|
|
1058 |
|
1059 |
# Question Answering
|
1060 |
with gr.TabItem("Question Answering", id="subtab_qa"):
|
1061 |
+
with gr.Group(elem_id="qa_box"):
|
1062 |
with gr.Row(equal_height=True):
|
1063 |
with gr.Column(scale=1):
|
1064 |
qa_text = gr.Textbox(
|
|
|
1087 |
|
1088 |
# Translation
|
1089 |
with gr.TabItem("Translation", id="subtab_translate"):
|
1090 |
+
with gr.Group(elem_id="translate_box"):
|
1091 |
with gr.Row(equal_height=True):
|
1092 |
with gr.Column(scale=1):
|
1093 |
translate_text = gr.Textbox(
|
|
|
1128 |
with gr.Tabs() as code_tabs:
|
1129 |
# Code Generation
|
1130 |
with gr.TabItem("Code Generation", id="subtab_code_gen"):
|
1131 |
+
with gr.Group(elem_id="code_gen_box"):
|
1132 |
with gr.Row(equal_height=True):
|
1133 |
with gr.Column(scale=1):
|
1134 |
code_language = gr.Dropdown(
|
|
|
1186 |
|
1187 |
# Code Explanation
|
1188 |
with gr.TabItem("Code Explanation", id="subtab_code_explain"):
|
1189 |
+
with gr.Group(elem_id="code_explain_box"):
|
1190 |
with gr.Row(equal_height=True):
|
1191 |
with gr.Column(scale=1):
|
1192 |
code_to_explain = gr.Code(
|
|
|
1221 |
|
1222 |
# Code Debugging
|
1223 |
with gr.TabItem("Code Debugging", id="subtab_code_debug"):
|
1224 |
+
with gr.Group(elem_id="code_debug_box"):
|
1225 |
with gr.Row(equal_height=True):
|
1226 |
with gr.Column(scale=1):
|
1227 |
code_to_debug = gr.Code(
|
|
|
1255 |
)
|
1256 |
|
1257 |
# Footer
|
1258 |
+
with gr.Group(elem_id="footer"):
|
1259 |
gr.Markdown(
|
1260 |
"""
|
1261 |
## About Gemma
|