Spaces:
Runtime error
Runtime error
Commit Β·
2abe079
1
Parent(s): f96aa11
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,19 +43,16 @@ def infer(prompt, samples, steps, scale):
|
|
| 43 |
return images_list
|
| 44 |
|
| 45 |
|
| 46 |
-
def generate_movie(
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
plot = data.iloc[random_number]["plot_synopsis_sum"]
|
| 50 |
image = infer(plot, 1, 50, 7.5)
|
| 51 |
-
state["number"] = random_number
|
| 52 |
-
state["title"] = data.iloc[int(random_number)]["title"]
|
| 53 |
|
| 54 |
-
return image["sample"][0],
|
| 55 |
|
| 56 |
|
| 57 |
-
def movie_title(
|
| 58 |
-
return
|
| 59 |
|
| 60 |
|
| 61 |
css = """
|
|
@@ -181,9 +178,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 181 |
label="Generated images", show_label=False, elem_id="image"
|
| 182 |
).style(height="auto")
|
| 183 |
|
| 184 |
-
|
| 185 |
|
| 186 |
-
b1.click(generate_movie, inputs=
|
| 187 |
-
b2.click(movie_title, inputs=
|
| 188 |
|
| 189 |
demo.launch()
|
|
|
|
| 43 |
return images_list
|
| 44 |
|
| 45 |
|
| 46 |
+
def generate_movie():
|
| 47 |
+
seed = randrange(data.shape[0])
|
| 48 |
+
plot = data.iloc[seed]["plot_synopsis_sum"]
|
|
|
|
| 49 |
image = infer(plot, 1, 50, 7.5)
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
return image["sample"][0], seed
|
| 52 |
|
| 53 |
|
| 54 |
+
def movie_title(seed):
|
| 55 |
+
return data.iloc[int(seed)]["title"]
|
| 56 |
|
| 57 |
|
| 58 |
css = """
|
|
|
|
| 178 |
label="Generated images", show_label=False, elem_id="image"
|
| 179 |
).style(height="auto")
|
| 180 |
|
| 181 |
+
seed = gr.Number(visible=False)
|
| 182 |
|
| 183 |
+
b1.click(generate_movie, inputs=None, outputs=[image, seed])
|
| 184 |
+
b2.click(movie_title, inputs=seed, outputs=text)
|
| 185 |
|
| 186 |
demo.launch()
|