Spaces:
Running
Running
Updated list of Working Models
Browse files
app.py
CHANGED
|
@@ -1,129 +1,89 @@
|
|
| 1 |
-
from models import *
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
GPT_4 = "deepseek/deepseek-chat-v3-0324:free" #12
|
| 5 |
-
PHI_4 = "microsoft/phi-4" #2
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
return
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
if
|
| 37 |
-
return
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
return chain.generate_response(
|
| 48 |
-
elif "
|
| 49 |
-
return chain.generate_response(
|
| 50 |
-
elif "
|
| 51 |
-
return chain.generate_response(
|
| 52 |
-
elif "
|
| 53 |
-
return chain.generate_response(
|
| 54 |
-
elif "
|
| 55 |
-
return chain.generate_response(
|
| 56 |
-
|
| 57 |
-
return
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
def main():
|
| 90 |
-
view = gr.Interface(
|
| 91 |
-
fn= get_model,
|
| 92 |
-
inputs = [
|
| 93 |
-
gr.Markdown("# Switch AI"),
|
| 94 |
-
gr.Markdown("### by Kalash"),
|
| 95 |
-
gr.Radio(
|
| 96 |
-
[
|
| 97 |
-
"ChatGPT", #1
|
| 98 |
-
"Phi-4", #2
|
| 99 |
-
"Phi-3", #3
|
| 100 |
-
"Gemma-3", #4
|
| 101 |
-
"Gemini-2-Flash-Think", #6
|
| 102 |
-
"Gemini-Flash", #7
|
| 103 |
-
"QwQ-32B", #9
|
| 104 |
-
"Qwen2.5", #11
|
| 105 |
-
"DeepSeek-R1", #12
|
| 106 |
-
"DeepSeek-R1-Zero", #12
|
| 107 |
-
"Llama-3.3", #15
|
| 108 |
-
"Mistral-Small", #16
|
| 109 |
-
"Mistral-Nemo", #17
|
| 110 |
-
"Zephyr", #18
|
| 111 |
-
"Olympic-Coder", #20
|
| 112 |
-
"LearnLM", #8
|
| 113 |
-
"Reka-Flash", #21
|
| 114 |
-
"OpenChat", #22
|
| 115 |
-
"Toppy", #22
|
| 116 |
-
"MoonLight", #22
|
| 117 |
-
],
|
| 118 |
-
label = "Choose AI Model", value = "ChatGPT"),
|
| 119 |
-
gr.Textbox(label = "Your Name", placeholder = "Enter Your Name"),
|
| 120 |
-
gr.Textbox(label = "Your Query", placeholder = "Enter Your Question"),
|
| 121 |
-
gr.Textbox(label = "System Prompt", placeholder = "Enter Custom System Propmt (Optional)"),
|
| 122 |
-
],
|
| 123 |
-
outputs = [gr.Textbox(label ="AI Response", lines = 25)],
|
| 124 |
-
flagging_mode = "never"
|
| 125 |
-
).launch(share=True)
|
| 126 |
-
# ).launch(share=False, server_port=54321)
|
| 127 |
-
|
| 128 |
-
if __name__ == '__main__':
|
| 129 |
main()
|
|
|
|
| 1 |
+
from models import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
GPT_4 = "deepseek/deepseek-chat-v3-0324:free" #12
|
| 5 |
+
PHI_4 = "microsoft/phi-4" #2
|
| 6 |
+
GEMMA_3_27B = "google/gemma-3-27b-it:free" #4
|
| 7 |
+
QWEN_32B = "qwen/qwq-32b:free" #8
|
| 8 |
+
QWEN_25 = "qwen/qwen2.5-vl-72b-instruct:free" #10 #error
|
| 9 |
+
DEEPSEEK_R1 = "deepseek/deepseek-r1:free" #11
|
| 10 |
+
DEEPSEEK_R1_ZERO = "deepseek/deepseek-r1-zero:free" #13
|
| 11 |
+
META_LLAMA_MODEL = "meta-llama/Llama-3.3-70B-Instruct:free" #14
|
| 12 |
+
MISTRAL_SMALL_MODEL = "mistralai/mistral-small-3.1-24b-instruct:free" #15
|
| 13 |
+
MISTRAL_NEMO = "mistralai/mistral-nemo:free" #16
|
| 14 |
+
|
| 15 |
+
CONCISE_ENGLISH_PROMPT = "Answer in short and precise English sentences."
|
| 16 |
+
|
| 17 |
+
def get_model(title, dev, model, name, user_input, system_prompt):
|
| 18 |
+
if user_input.lower() == "data":
|
| 19 |
+
df = get_data()
|
| 20 |
+
return df
|
| 21 |
+
|
| 22 |
+
if user_input.lower() == "text":
|
| 23 |
+
text = get_text()
|
| 24 |
+
return text
|
| 25 |
+
|
| 26 |
+
if name == "" or name is None:
|
| 27 |
+
return "Enter Your Name !"
|
| 28 |
+
|
| 29 |
+
if model is None or model == "":
|
| 30 |
+
return "Select AI Model !"
|
| 31 |
+
|
| 32 |
+
chain = ModelChain()
|
| 33 |
+
prompt = system_prompt + " " + CONCISE_ENGLISH_PROMPT
|
| 34 |
+
|
| 35 |
+
# Check the model and map to the correct model
|
| 36 |
+
if "ChatGPT" == model: #1
|
| 37 |
+
return chain.generate_response(GPT_4, name, user_input, prompt)
|
| 38 |
+
elif "Phi-4" == model: #2
|
| 39 |
+
return chain.generate_response(PHI_4, name, user_input, prompt)
|
| 40 |
+
elif "Gemma-3" == model: #4
|
| 41 |
+
return chain.generate_response(GEMMA_3_27B, name, user_input, prompt)
|
| 42 |
+
elif "QwQ-32B" == model: #8
|
| 43 |
+
return chain.generate_response(QWEN_32B, name, user_input, prompt)
|
| 44 |
+
elif "Qwen2.5" == model: #10
|
| 45 |
+
return chain.generate_response(QWEN_25, name, user_input, prompt)
|
| 46 |
+
elif "DeepSeek-R1" == model: #11
|
| 47 |
+
return chain.generate_response(DEEPSEEK_R1, name, user_input, prompt)
|
| 48 |
+
elif "DeepSeek-R1-Zero" == model: #11
|
| 49 |
+
return chain.generate_response(DEEPSEEK_R1, name, user_input, prompt)
|
| 50 |
+
elif "Llama-3.3" == model: #14
|
| 51 |
+
return chain.generate_response(META_LLAMA_MODEL, name, user_input, prompt)
|
| 52 |
+
elif "Mistral-Small" == model: #15
|
| 53 |
+
return chain.generate_response(MISTRAL_SMALL_MODEL, name, user_input, prompt)
|
| 54 |
+
elif "Mistral-Nemo" == model: #16
|
| 55 |
+
return chain.generate_response(MISTRAL_NEMO, name, user_input, prompt)
|
| 56 |
+
else:
|
| 57 |
+
return "Invalid Model Name : " + model
|
| 58 |
+
|
| 59 |
+
def main():
|
| 60 |
+
view = gr.Interface(
|
| 61 |
+
fn= get_model,
|
| 62 |
+
inputs = [
|
| 63 |
+
gr.Markdown("# Switch AI"),
|
| 64 |
+
gr.Markdown("### by Kalash"),
|
| 65 |
+
gr.Radio(
|
| 66 |
+
[
|
| 67 |
+
"ChatGPT", #1
|
| 68 |
+
"Phi-4", #2
|
| 69 |
+
"Gemma-3", #4
|
| 70 |
+
"QwQ-32B", #9
|
| 71 |
+
"Qwen2.5", #11
|
| 72 |
+
"DeepSeek-R1", #12
|
| 73 |
+
"DeepSeek-R1-Zero", #12
|
| 74 |
+
"Llama-3.3", #15
|
| 75 |
+
"Mistral-Small", #16
|
| 76 |
+
"Mistral-Nemo", #17
|
| 77 |
+
],
|
| 78 |
+
label = "Choose AI Model", value = "ChatGPT"),
|
| 79 |
+
gr.Textbox(label = "Your Name", placeholder = "Enter Your Name"),
|
| 80 |
+
gr.Textbox(label = "Your Query", placeholder = "Enter Your Question"),
|
| 81 |
+
gr.Textbox(label = "System Prompt", placeholder = "Enter Custom System Propmt (Optional)"),
|
| 82 |
+
],
|
| 83 |
+
outputs = [gr.Textbox(label ="AI Response", lines = 25)],
|
| 84 |
+
flagging_mode = "never"
|
| 85 |
+
).launch(share=True)
|
| 86 |
+
# ).launch(share=False, server_port=54321)
|
| 87 |
+
|
| 88 |
+
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
main()
|