-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6a9d97
commit d2d0263
Showing
2 changed files
with
1,687 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using UnityEngine; | ||
using System.Collections.Generic; | ||
using System.Collections; | ||
using UnityEngine.UI; | ||
using HuggingFace; | ||
|
||
public class Simple_BERT_App : MonoBehaviour { | ||
|
||
public string flask_url = "http://localhost:5000"; | ||
|
||
public Button next_sentence_btn; | ||
|
||
Pipeline transformers = new Pipeline(); | ||
|
||
ArrayList next_sentence_queue = new ArrayList (); | ||
|
||
void Start () { | ||
|
||
next_sentence_btn.onClick.AddListener(next_sentence); | ||
|
||
} | ||
|
||
public void next_sentence(){ | ||
// Provide the next N sentences for the input sequence, it will consider the return as the new input during iteration. | ||
StartCoroutine(transformers.task("next_sentence","I never thought it would be this hard to create #3",flask_url,next_sentence_queue)); | ||
} | ||
|
||
void Update () { | ||
|
||
if (next_sentence_queue.Count >= 1){ | ||
Dictionary<string, string> next_sentence_payload_dict; | ||
string next_sentence_payload = (string)next_sentence_queue [0]; | ||
next_sentence_queue.RemoveRange (0, 1); | ||
next_sentence_payload_dict = transformers.convert_to_dict(next_sentence_payload); | ||
Debug.Log(next_sentence_payload_dict["next_sentence"]); | ||
|
||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.