File size: 2,841 Bytes
eeb235a
 
 
b1c92f3
 
eeb235a
 
 
b1c92f3
eeb235a
 
b1c92f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eeb235a
b1c92f3
eeb235a
 
 
 
1
2
3
4
5
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
  <head>
    <title>FragMixt: Your AI-Powered Coding Assistant</title>
    <script src="https://cdn.jsdelivr.net/npm/@gradio/gradio@latest/gradio.min.js"></script>
  </head>
  <body>
    <div id="my_gradio_app">
      <!-- The embedded FragMixt app will be displayed here -->
    </div>
    <script>
      const iface = gr.Blocks()
        .with_tab("Model", [
          gr.Dropdown(
            choices=["Code Generation", "Code Explanation", "Code Optimization", "Code Translation"],
            label="Model Task",
            value="Code Generation"
          ),
          gr.Dropdown(
            choices=[],
            label="Hugging Face Model"
          ),
          gr.Button("Load Model"),
          gr.Textbox(label="Status"),
          gr.Markdown(label="Model Description")
        ])
        .with_tab("Code Assistant", [
          gr.Chatbot(show_label=false, show_share_button=false, show_copy_button=true, likeable=true),
          gr.Textbox(label="Enter your code or query", placeholder="Ask me anything related to code!"),
          gr.Dropdown(label="Programming Language", choices=["Python", "JavaScript", "Java", "C++", "C#", "Ruby", "Go", "Rust", "Swift", "Kotlin"], value="Python", interactive=true),
          gr.Textbox(label="Context", placeholder="Provide any additional context or requirements", max_lines=3, interactive=true),
          gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, step=0.05, interactive=true, info="Higher values produce more diverse outputs"),
          gr.Slider(label="Max new tokens", minimum=0, maximum=1048 * 10, step=64, interactive=true, info="The maximum numbers of new tokens"),
          gr.Slider(label="Top-p (nucleus sampling)", minimum=0.0, maximum=1, step=0.05, interactive=true, info="Higher values sample more low-probability tokens"),
          gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, interactive=true, info="Penalize repeated tokens"),
          gr.Button(value="Submit"),
          gr.State([]),
          gr.Button(value="+", variant="primary"),
        ])
        .with_tab("Project", [
          gr.Textbox(label="Project Name", placeholder="MyCodeProject"),
          gr.Button("Create Project"),
          gr.Textbox(label="Output", lines=5),
          gr.Code(label="Code Editor", language="python", lines=20),
          gr.Textbox(label="File Path", placeholder="src/main.py"),
          gr.Button("Read File"),
          gr.Button("Save File"),
          gr.Textbox(label="Terminal Command", placeholder="pip install -r requirements.txt"),
          gr.Textbox(label="Command Output", lines=5),
          gr.Button("Run Command"),
          gr.Button("Preview Project")
        ]);

      // Render the embedded FragMixt app
      iface.mount("my_gradio_app");
    </script>
  </body>
</html>