whackthejacker commited on
Commit
bf3219e
·
verified ·
1 Parent(s): 0e27eee

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -0
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Load the models
4
+ models = {
5
+ "bigcode/python-stack-v1-functions-filtered-sc2-subset": gr.Interface.load("bigcode/python-stack-v1-functions-filtered-sc2-subset"),
6
+ "bigcode/python-stack-v1-functions-filtered-sc2": gr.Interface.load("bigcode/python-stack-v1-functions-filtered-sc2"),
7
+ "muellerzr/python-stack-v1-functions-filtered-llama-3-8B": gr.Interface.load("muellerzr/python-stack-v1-functions-filtered-llama-3-8B"),
8
+ "YoLo2000/python-stack-functions-filtered": gr.Interface.load("YoLo2000/python-stack-functions-filtered"),
9
+ "YoLo2000/python-stack-functions-filteredbigcode/python-stack-v1-functions-filtered-sc2": gr.Interface.load("YoLo2000/python-stack-functions-filteredbigcode/python-stack-v1-functions-filtered-sc2"),
10
+ "TheBloke/Python-Code-13B-GGUF": gr.Interface.load("TheBloke/Python-Code-13B-GGUF"),
11
+ "replit/replit-code-v1_5-3b": gr.Interface.load("replit/replit-code-v1_5-3b"),
12
+ "neulab/codebert-python": gr.Interface.load("neulab/codebert-python")
13
+ }
14
+
15
+ # Load the datasets
16
+ datasets = {
17
+ "kye/all-huggingface-python-code": gr.Dataset.load("kye/all-huggingface-python-code"),
18
+ "ajibawa-2023/WikiHow": gr.Dataset.load("ajibawa-2023/WikiHow"),
19
+ "ajibawa-2023/Code-74k-ShareGPT": gr.Dataset.load("ajibawa-2023/Code-74k-ShareGPT"),
20
+ "ajibawa-2023/Software-Architectural-Frameworks": gr.Dataset.load("ajibawa-2023/Software-Architectural-Frameworks"),
21
+ "ajibawa-2023/Python-Code-23k-ShareGPT": gr.Dataset.load("ajibawa-2023/Python-Code-23k-ShareGPT"),
22
+ "HuggingFaceFW/fineweb": gr.Dataset.load("HuggingFaceFW/fineweb"),
23
+ "kye/all-huggingface-python-code-2": gr.Dataset.load("kye/all-huggingface-python-code-2"),
24
+ "suvadityamuk/huggingface-transformers-code-dataset": gr.Dataset.load("suvadityamuk/huggingface-transformers-code-dataset")
25
+ }
26
+
27
+ # Define the interface
28
+ def generate_code(prompt, model, dataset, temperature, max_length):
29
+ model_instance = models[model]
30
+ dataset_instance = datasets[dataset]
31
+ output = model_instance.generate(prompt, dataset_instance, temperature, max_length)
32
+ return output
33
+
34
+ iface = gr.Interface(
35
+ fn=generate_code,
36
+ inputs=[
37
+ ________gr.Textbox(label="Prompt"),
38
+ ________gr.Dropdown(label="Model",_choices=list(models.keys())),
39
+ ________gr.Dropdown(label="Dataset",_choices=list(datasets.keys())),
40
+ ________gr.Slider(label="Temperature",_minimum=0.1,_maximum=1.0,_default=0.5),
41
+ ________gr.Slider(label="Max_Length",_minimum=10,_maximum=1000,_default=200)
42
+ ____],
43
+ outputs="text"
44
+ )
45
+
46
+ # Launch the interface
47
+ iface.launch()
48
+