minjibi commited on
Commit
ca0a664
·
1 Parent(s): bf488dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -38,11 +38,16 @@ def predict(text):
38
  for g in generated_ids
39
  ]
40
 
41
- output = ['Question: '+ text.replace('A', 'Answer') for text in preds]
42
  #final_str = '\n'.join([f"{i+1}. {s}" for i, s in enumerate(output)])
43
  final_str = '\n'.join([f"{i+1}. Question: {s.split('Answer')[0].strip()}\n Answer{s.split('Answer')[1].strip()}" for i, s in enumerate(output)])
44
 
45
  return final_str
46
-
47
- iface = gr.Interface(fn=predict, inputs="text", outputs="text")
 
 
 
 
 
48
  iface.launch()
 
38
  for g in generated_ids
39
  ]
40
 
41
+ output = [text.replace('A', 'Answer') for text in preds]
42
  #final_str = '\n'.join([f"{i+1}. {s}" for i, s in enumerate(output)])
43
  final_str = '\n'.join([f"{i+1}. Question: {s.split('Answer')[0].strip()}\n Answer{s.split('Answer')[1].strip()}" for i, s in enumerate(output)])
44
 
45
  return final_str
46
+ examples = [
47
+ ["ไพธอนเป็นภาษาการเขียนโปรแกรมที่มีการตีความระดับสูงและมีวัตถุประสงค์ทั่วไป ภาษาคอมพิวเตอร์นี้สร้างโดย Guido van Rossum และเปิดตัวครั้งแรกในปี 1991"],
48
+ ["แมว ชื่อวิทยาศาสตร์ (Felis catus) เป็นสปีชีส์สัตว์เลี้ยงของสัตว์เลี้ยงลูกด้วยนมกินเนื้อขนาดเล็ก โดยเป็นแมวสปีชีส์เดียวในวงศ์ Felidae ที่ถูกปรับเป็นสัตว์เลี้ยง และมักเรียกเป็น แมวบ้าน เพื่อแยกมันจากสมาชิกที่อยู่ในป่า"],
49
+ ]
50
+
51
+
52
+ iface = gr.Interface(fn=predict, inputs="text", outputs="text", examples=examples)
53
  iface.launch()