hugfaceguy0001 commited on
Commit
4c8b1bb
β€’
1 Parent(s): 08fee89

update app.py to fix default poem

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,14 +4,14 @@ import random
4
 
5
  dataset = load_dataset("hugfaceguy0001/TangshiDalle3Images")['train']
6
  demo = gr.Blocks(theme=gr.themes.Default(text_size="lg"))
7
- N = random.randint(0,230)
8
  j = 3 * N + 1
9
  poem_text = dataset[j]['prompt']
10
  poem_info = dataset[j+1]['prompt']
11
  poem_title = poem_info[poem_info.index("γ€Š")+1:poem_info.index("》")]
12
  poem_author = poem_info[3:poem_info.index("ηš„")]
13
  poem = f" {poem_title} {poem_author}\n{poem_text}"
14
- k = j + random.randint(-1,1)
15
  poem_image = dataset[k]['image']
16
  def random_poem():
17
  global N
 
4
 
5
  dataset = load_dataset("hugfaceguy0001/TangshiDalle3Images")['train']
6
  demo = gr.Blocks(theme=gr.themes.Default(text_size="lg"))
7
+ N = 149
8
  j = 3 * N + 1
9
  poem_text = dataset[j]['prompt']
10
  poem_info = dataset[j+1]['prompt']
11
  poem_title = poem_info[poem_info.index("γ€Š")+1:poem_info.index("》")]
12
  poem_author = poem_info[3:poem_info.index("ηš„")]
13
  poem = f" {poem_title} {poem_author}\n{poem_text}"
14
+ k = j - 1
15
  poem_image = dataset[k]['image']
16
  def random_poem():
17
  global N