Skip to content

Commit

Permalink
try to fix bug in UI -- #77
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouwg committed Mar 10, 2024
1 parent 3a881b4 commit bad8196
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ Changelog could be found <a href="https://github.com/cdeos/kantv/blob/master/rel

### Roadmap

- real-time English subtitle for online English TV on Xiaomi 14 by excellent and amazing ![whisper.cpp](https://github.com/ggerganov/whisper.cpp)
- real-time English subtitle for online English TV on Xiaomi 14(because it contains a very powerful mobile SoC) by excellent and amazing ![whisper.cpp](https://github.com/ggerganov/whisper.cpp)

- real-time Chinese subtitle for online English TV on Xiaomi 14 by excellent and amazing ![whisper.cpp](https://github.com/ggerganov/whisper.cpp)
- real-time Chinese subtitle for online English TV on Xiaomi 14(because it contains a very powerful mobile SoC) by excellent and amazing ![whisper.cpp](https://github.com/ggerganov/whisper.cpp)

- integrate ![gstreamer](https://github.com/cdeos/gstreamer) to project KanTV(<a href="https://www.videolan.org/vlc/" target="_blank">VLC</a> is also excellent and gstreamer is more complicated than VLC but gstreamer was supported by many semiconductor companies. anyway, they are both born in/come from EU)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ private void switchFragment(Class clazz) {
getFragmentTransaction().hide(previousFragment).commit();
}

if (previousFragment != null) {
String fragmentName = previousFragment.getClass().getName();
if (fragmentName.contains("ASRFragment")) {
CDELog.j(TAG, "release ASR resource");
asrFragment.release();
}
}


if (clazz == TVGridFragment.class) {
if (homeFragment == null) {
homeFragment = TVGridFragment.newInstance();
Expand Down Expand Up @@ -385,4 +394,4 @@ public void onClick(DialogInterface dialog, int which) {
}

public static native int kantv_anti_tamper();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ public class ASRFragment extends BaseMvpFragment<ASRPresenter> implements ASRVie
private static final int BECHMARK_ASR = 2;
private static final int BECHMARK_FULL = 3; //very slow on Android phone

private int nThreadCounts = 1;
private int benchmarkIndex = 0;
private String strModeName = "tiny";
private int nThreadCounts = 1;
private int benchmarkIndex = 0;
private String strModeName = "tiny";

private long beginTime = 0;
private long endTime = 0;
private long duration = 0;
private long beginTime = 0;
private long endTime = 0;
private long duration = 0;
private String strBenchmarkInfo;

private AtomicBoolean isBenchmarking = new AtomicBoolean(false);
private ProgressDialog mProgressDialog;

private String ggmlModelFileName = "ggml-tiny.bin";
private String ggmlSampleFileName = "jfk.wav";
private String ggmlModelFileName = "ggml-tiny.bin";
private String ggmlSampleFileName = "jfk.wav";

private Context mContext;
private Activity mActivity;
Expand Down Expand Up @@ -290,10 +290,7 @@ public void run() {
initKANTVMgr();
whispercpp.set_benchmark_status(0);

if (mKANTVMgr != null) {
mKANTVMgr.initASR();
mKANTVMgr.startASR();
}


while (isBenchmarking.get()) {
beginTime = System.currentTimeMillis();
Expand Down Expand Up @@ -481,6 +478,10 @@ private void initKANTVMgr() {

try {
mKANTVMgr = new KANTVMgr(mEventListener);
if (mKANTVMgr != null) {
mKANTVMgr.initASR();
mKANTVMgr.startASR();
}
CDELog.j(TAG, "KANTVMgr version:" + mKANTVMgr.getMgrVersion());
} catch (KANTVException ex) {
String errorMsg = "An exception was thrown because:\n" + " " + ex.getMessage();
Expand Down
1 change: 1 addition & 0 deletions external/whispercpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ include_directories(${PREBUIT_INC_PATH}/)

add_definitions(-DTARGET_ANDROID)
add_definitions(-D__ARM_NEON)
#add_definitions(-DGGML_USE_ACCELERATE)
#add_definitions(-DGGML_USE_CLBLAST)
add_definitions(-DGGML_USE_OPENBLAS)

Expand Down

0 comments on commit bad8196

Please sign in to comment.