File size: 3,661 Bytes
5062648
 
 
 
 
 
 
e405859
c52c0f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5062648
c52c0f1
5062648
e405859
c52c0f1
 
5062648
e405859
c52c0f1
 
5062648
e405859
c52c0f1
 
5062648
e405859
c52c0f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import torch
from torch import nn
import lightning.pytorch as pl
from torchvision import datasets
from torch.nn import functional as F
from torch.utils.data import DataLoader, Dataset, random_split

def generate_art(character_dropdown, seed_slider):

  if character_dropdown == "NONE":
    return "NULL"
  else:
    return "NOT NULL"

  return "Hello There!"


HTML_TEMPLATE = """    
<style>
    
    #app-header {
        text-align: center;
        background: rgba(255, 255, 255, 0.8); /* 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 */
    }
    #app-header h1 {
        color: #f308eb;
        font-size: 2em;
        margin-bottom: 10px;
    }
    .concept {
        position: relative;
        transition: transform 0.3s;
    }
    .concept:hover {
        transform: scale(1.1);
    }
    .concept img {
        width: 100px;
        border-radius: 10px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    .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;
    }
    /* Artifacts */
    
</style>
<div id="app-header">
    <!-- Artifacts -->
    <div class="artifact large"></div>
    <div class="artifact medium"></div>
    <div class="artifact small"></div>
    <!-- Content -->
    <h1>Shakespeare Dialogue Generator</h1>
    <p>Generate new dialogue for Shakespearean character by selecting character from dropdown.</p>
        <div style="display: flex; justify-content: center; gap: 20px; margin-top: 20px;">
        <div class="concept">
            <img src="https://github.com/santule/ERA/assets/20509836/b6b4031a-265d-43f6-bd59-813097c0022b" alt="Romeo">
            <div class="concept-description">Romeo</div>
        </div>
        <div class="concept">
            <img src="https://github.com/santule/ERA/assets/20509836/4333692c-54f7-42e4-b53a-14044c8151a3" alt="Juliet">
            <div class="concept-description">Juliet</div>
        </div>
        <div class="concept">
            <img src="https://github.com/santule/ERA/assets/20509836/7e03233a-bf1d-48aa-b156-46f525aa76c6" alt="Shakespeare">
            <div class="concept-description">Shakespeare</div>
        </div>
        <div class="concept">
            <img src="https://github.com/santule/ERA/assets/20509836/0dd19c74-72e5-4ea5-8f66-06b7655b81aa" alt="King Richard III">
            <div class="concept-description">King Richard III</div>
        </div>
    </div>
</div>
"""

with gr.Blocks() as interface:
    gr.HTML(value=HTML_TEMPLATE, show_label=False)
    with gr.Row():
        character_dropdown = gr.Dropdown(
            label="Select a Character",
            choices=["NONE","ROMEO","OPHELIA","DESDEMONA","MACDUFF"],
            value='Dream'
        )
        seed_slider = gr.Slider(
            label="Random Seed",
            minimum=0,
            maximum=1000,
            step=1,
            value=42
        )
        inputs = [character_dropdown, seed_slider]

    with gr.Row():
        outputs = gr.Textbox(
            label="Generated Dialogue"
        )

    with gr.Row():
        button = gr.Button("Generate Dialogue")
        button.click(generate_art, inputs=inputs, outputs=outputs)


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