lunarflu HF Staff commited on
Commit
2d9f78f
·
1 Parent(s): f2e2105

[falcon] testing with job done and result

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -573,7 +573,7 @@ async def falcon(ctx, *, prompt: str):
573
 
574
  instructions = "The following is a conversation between a highly knowledgeable and intelligent AI assistant, called Falcon, and a human user, called User. The conversation may begin with a unique UUID, and if it does, the UUID can be ignored. In the following interactions, User and Falcon will converse in natural language, and Falcon will answer User's questions. Falcon was built to be respectful, polite and inclusive. Falcon was built by the Technology Innovation Institute in Abu Dhabi. Falcon will never decline to answer a question, and always attempts to give an answer that User would be satisfied with. It knows a lot, and always tells the truth. The conversation begins."
575
  randomuuid = str(uuid.uuid4())
576
- prompt = randomuuid + " " + prompt
577
 
578
  #fn 5 -> fn 1
579
  # will give something like = /tmp/tmpklf60u2h.json, which will contain something like [["What day is today?", "Today"]] (prompt, generation)
@@ -582,9 +582,17 @@ async def falcon(ctx, *, prompt: str):
582
  status = job.status()
583
  print(status)
584
  time.sleep(0.1)
 
585
  if job.done() == True:
586
  print(job.result())
 
587
 
 
 
 
 
 
 
588
  directory = '/tmp/'
589
 
590
  max_length = 0
@@ -609,7 +617,10 @@ async def falcon(ctx, *, prompt: str):
609
  data = json.load(file)
610
  await ctx.reply(f"Here's the resulting json file:\n{data}")
611
  else:
612
- print("No JSON file containing the UUID was found.")
 
 
 
613
  '''
614
  result2 = falconspace.predict(
615
  prompt, # str in 'Type an input and press Enter' Textbox component
 
573
 
574
  instructions = "The following is a conversation between a highly knowledgeable and intelligent AI assistant, called Falcon, and a human user, called User. The conversation may begin with a unique UUID, and if it does, the UUID can be ignored. In the following interactions, User and Falcon will converse in natural language, and Falcon will answer User's questions. Falcon was built to be respectful, polite and inclusive. Falcon was built by the Technology Innovation Institute in Abu Dhabi. Falcon will never decline to answer a question, and always attempts to give an answer that User would be satisfied with. It knows a lot, and always tells the truth. The conversation begins."
575
  randomuuid = str(uuid.uuid4())
576
+ #prompt = randomuuid + " " + prompt
577
 
578
  #fn 5 -> fn 1
579
  # will give something like = /tmp/tmpklf60u2h.json, which will contain something like [["What day is today?", "Today"]] (prompt, generation)
 
582
  status = job.status()
583
  print(status)
584
  time.sleep(0.1)
585
+
586
  if job.done() == True:
587
  print(job.result())
588
+ finalresult=job.result()
589
 
590
+ with open(finalresult, 'r') as file:
591
+ data = json.load(file)
592
+ generation = data[1]
593
+ await ctx.reply(f"{generation}")
594
+
595
+ '''
596
  directory = '/tmp/'
597
 
598
  max_length = 0
 
617
  data = json.load(file)
618
  await ctx.reply(f"Here's the resulting json file:\n{data}")
619
  else:
620
+ print("No JSON file containing the UUID was found.")
621
+
622
+ '''
623
+
624
  '''
625
  result2 = falconspace.predict(
626
  prompt, # str in 'Type an input and press Enter' Textbox component