Etash Guha
commited on
Commit
·
7fdd67e
1
Parent(s):
0570cb7
working
Browse files- app.py +2 -1
- generators/factory.py +2 -20
app.py
CHANGED
|
@@ -94,7 +94,8 @@ with chat_col:
|
|
| 94 |
button = st.button("Send")
|
| 95 |
|
| 96 |
if button:
|
| 97 |
-
|
|
|
|
| 98 |
if user_input == "":
|
| 99 |
st.warning("Missing a coding problem")
|
| 100 |
fail = True
|
|
|
|
| 94 |
button = st.button("Send")
|
| 95 |
|
| 96 |
if button:
|
| 97 |
+
|
| 98 |
+
|
| 99 |
if user_input == "":
|
| 100 |
st.warning("Missing a coding problem")
|
| 101 |
fail = True
|
generators/factory.py
CHANGED
|
@@ -1,40 +1,22 @@
|
|
| 1 |
from .py_generate import PyGenerator
|
| 2 |
-
from .rs_generate import RsGenerator
|
| 3 |
-
from .go_generate import GoGenerator
|
| 4 |
from .generator_types import Generator
|
| 5 |
-
from .model import
|
| 6 |
-
|
| 7 |
|
| 8 |
def generator_factory(lang: str) -> Generator:
|
| 9 |
if lang == "py" or lang == "python":
|
| 10 |
return PyGenerator()
|
| 11 |
-
elif lang == "rs" or lang == "rust":
|
| 12 |
-
return RsGenerator()
|
| 13 |
-
elif lang == "go" or lang == "golang":
|
| 14 |
-
return GoGenerator()
|
| 15 |
else:
|
| 16 |
raise ValueError(f"Invalid language for generator: {lang}")
|
| 17 |
|
| 18 |
|
| 19 |
def model_factory(model_name: str) -> ModelBase:
|
|
|
|
| 20 |
if model_name == "gpt-4":
|
| 21 |
return GPT4()
|
| 22 |
-
elif model_name == "gpt-4o":
|
| 23 |
-
return GPT4o()
|
| 24 |
elif model_name == "samba":
|
| 25 |
return Samba()
|
| 26 |
-
elif model_name == "groq":
|
| 27 |
-
return GroqBase()
|
| 28 |
elif model_name == "gpt-3.5-turbo-0613":
|
| 29 |
return GPT35()
|
| 30 |
-
elif model_name == "starchat":
|
| 31 |
-
return StarChat()
|
| 32 |
-
elif model_name.startswith("codellama"):
|
| 33 |
-
# if it has `-` in the name, version was specified
|
| 34 |
-
kwargs = {}
|
| 35 |
-
if "-" in model_name:
|
| 36 |
-
kwargs["version"] = model_name.split("-")[1]
|
| 37 |
-
return CodeLlama(**kwargs)
|
| 38 |
elif model_name.startswith("text-davinci"):
|
| 39 |
return GPTDavinci(model_name)
|
| 40 |
else:
|
|
|
|
| 1 |
from .py_generate import PyGenerator
|
|
|
|
|
|
|
| 2 |
from .generator_types import Generator
|
| 3 |
+
from .model import ModelBase, GPT4, GPT35, GPTDavinci, Samba
|
|
|
|
| 4 |
|
| 5 |
def generator_factory(lang: str) -> Generator:
|
| 6 |
if lang == "py" or lang == "python":
|
| 7 |
return PyGenerator()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
else:
|
| 9 |
raise ValueError(f"Invalid language for generator: {lang}")
|
| 10 |
|
| 11 |
|
| 12 |
def model_factory(model_name: str) -> ModelBase:
|
| 13 |
+
print(model_name)
|
| 14 |
if model_name == "gpt-4":
|
| 15 |
return GPT4()
|
|
|
|
|
|
|
| 16 |
elif model_name == "samba":
|
| 17 |
return Samba()
|
|
|
|
|
|
|
| 18 |
elif model_name == "gpt-3.5-turbo-0613":
|
| 19 |
return GPT35()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
elif model_name.startswith("text-davinci"):
|
| 21 |
return GPTDavinci(model_name)
|
| 22 |
else:
|