File size: 3,266 Bytes
4581574
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env python
# coding: utf-8

# In[2]:


import gradio as gr
import torch
from torch import nn
from torch.nn import functional as F
from nano_gpt_inferencing import generate_paragraph


HTML_TEMPLATE = """    
     <style>
        body {
            font-family: 'Arial', sans-serif;
            background: #3498db; /* Blue background color */
            margin: 0;
            padding: 0;
        }

        #app-header {
            text-align: center;
            background: rgba(255, 255, 255, 0.7); /* Semi-transparent white */
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            position: relative; /* To position the artifacts */
            margin: 30px auto;
            max-width: 600px;
        }

        #app-header h1 {
            color: #FF0000;
            font-size: 2.5em;
            margin-bottom: 10px;
        }

        .header-images {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 20px 0;
        }

        .header-image {
            width: 100px;
            height: 100px;
            margin: 0 10px;
            background: #fff;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
        }

        .header-image img {
            max-width: 80px;
            max-height: 80px;
            border-radius: 50%;
        }

        .concept-description {
            position: absolute;
            bottom: -30px;
            left: 50%;
            transform: translateX(-50%);
            background-color: #4CAF50;
            color: white;
            padding: 5px 10px;
            border-radius: 5px;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .concept:hover .concept-description {
            opacity: 1;
        }
    </style>
</head>
<body>
<div id="app-header">
    <!-- Header Images -->
    <div class="header-images">
        <div class="header-image">
            <img src="https://github.com/nkanungo/ERAS20/blob/main/images/ss1.jpg?raw=true" alt="Image 1">
        </div>
        <div class="header-image">
            <img src="https://github.com/nkanungo/ERAS20/blob/main/images/ss1.jpg?raw=true" alt="Image 2">
        </div>
    </div>
    <!-- Content -->
    <h1>Paragraph Auto Completion like Shakespeare </h1>
    <p>Generate dialogue using the intellignece from Shakespeare Dataset .</p>
    <p>Model: GPT, Dataset: Tiny Shakespeare, Token limit: User input ,Input Text: User input.</p>
</div>
"""
with gr.Blocks(theme=gr.themes.Glass()) as interface:
    gr.HTML(value=HTML_TEMPLATE, show_label=False)
    
    with gr.Row(scale=1):
       
        
        inputs = [
            gr.Textbox(label="Input Text Prompt"),
            gr.Textbox(label="Token Limit")
        ]
        outputs = gr.Textbox(
            label="Generated Paragraph"
        )

     
    with gr.Column(scale=1):
        button = gr.Button("Generate")
        button.click(generate_paragraph, inputs=inputs, outputs=outputs)

if __name__ == "__main__":
    interface.launch(enable_queue=True)


# In[ ]: