FER Macbeth Project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
1.9 KiB

#pragma once
#include "ofMain.h"
#include "ofxGui.h"
#include "LLMRequestThread.h"
struct Line {
int idx;
std::string sentence;
std::string speaker;
std::string emotion;
};
class ofTeleprompter: public ofBaseApp{
public:
void setup();
void update();
void draw();
void setupGUI();
void nextLinePressed();
void resetScript();
void sendLLMRequest();
void loadText();
void drawText();
void updateCVData(int numOfFacesDetected, std::string emotion, float intensity);
void toggleOffLLM(bool & val);
void toggleOffText(bool & val);
std::string wrapStringToWidth(const std::string& text, float maxWidth);
ofxPanel gui;
/* paramters */
ofxFloatSlider temperature;
ofxButton nextLine;
ofxToggle useLLMOnly;
ofxToggle useTextOnly;
ofxButton reset;
ofxLabel currentLineIndex;
ofxLabel currentSpeaker;
ofxLabel currentEmotion;
ofxLabel facesDetected;
ofxLabel emotionIntensity;
ofxLabel emotionDetected;
/* script */
std::vector<Line> script;
std::string filePath = "text/Macbeth.json";
int currentLine = 0;
std::string currentLineString = "N/A";
const char* emotions[7] = {"anger", "disgust", "fear", "happiness", "neutral", "sadness", "surprise"};
/* scrolling text */
int currentLetterIndex = 0;
std::string currentSentence;
uint64_t lastWordTime = 0;
uint64_t wordDelay = 10;
std::string displayedSentence;
ofTrueTypeFont textFont;
ofTrueTypeFont detailsFont;
/* llm stuff */
LLMRequestThread llmThread;
std::string llmResponse;
float currentEmotionIntensity = 0;
std::string currentEmotionDetetced = "neutral";
bool waitingForLLM = false;
private:
};