File size: 2,499 Bytes
6e793bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Text-to-Code Generator</title>
    <style>

        body {

            font-family: Arial, sans-serif;

            margin: 0;

            padding: 20px;

            background-color: #f4f4f9;

        }

        .container {

            max-width: 800px;

            margin: auto;

            background: white;

            padding: 20px;

            border-radius: 8px;

            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

        }

        h1 {

            text-align: center;

            color: #333;

        }

        textarea {

            width: 100%;

            height: 100px;

            margin-bottom: 10px;

            padding: 10px;

            border-radius: 4px;

            border: 1px solid #ccc;

        }

        button {

            padding: 10px 20px;

            background-color: #007bff;

            color: white;

            border: none;

            border-radius: 4px;

            cursor: pointer;

        }

        button:hover {

            background-color: #0056b3;

        }

        pre {

            background-color: #f8f9fa;

            padding: 10px;

            border-radius: 4px;

            overflow-x: auto;

        }

        .attribution {

            margin-top: 20px;

            font-size: 0.9em;

            color: #555;

            text-align: center;

        }

    </style>
</head>
<body>
    <div class="container">
        <h1>Text-to-Code Generator</h1>
        <form method="POST">
            <textarea name="prompt" placeholder="Enter a prompt (e.g., 'Write a Python function to calculate factorial')" required>{{ prompt }}</textarea>
            <button type="submit">Generate Code</button>
        </form>
        {% if generated_code %}
            <h2>Generated Code:</h2>
            <pre>{{ generated_code }}</pre>
        {% endif %}
        <div class="attribution">
            <p>Built with the fine-tuned </a href="https://huggingface.co/Salesforce/codegen-350M-multi" target="_blank">Salesforce/codegen-350M-multi</a> model.</p>
            <p>Developed by </a href="https://huggingface.co/remiai3" target="_blank">remiai3</a> for educational use. Licensed under Apache-2.0.</p>
            <p>Free resources for students to experiment with AI model development.</p>
        </div>
    </div>
</body>
</html>